package com.xs.designpattern;

import lombok.AllArgsConstructor;

/**
 * 屠龙者
 * @author xs
 */
@AllArgsConstructor
public class DragonSlayer {
    private DragonSlayingStrategy strategy;

    /**
     * 改变屠龙策略
     * @param strategy 屠龙策略
     */
    public void changeStrategy(DragonSlayingStrategy strategy) {
        this.strategy = strategy;
    }

    /**
     * 执行屠龙策略
     */
    public void goToBattle() {
        strategy.execute();
    }
}
